{extend name="public/base" /}
{block name="container"}
<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>成衣库存盘点记录</h5>
                    </div>
                    <div class="ibox-content">
                        <div class="row">
                            <form action="" method="post">
                                <div class="col-sm-3" style="float: right;">
                                    <div class="input-group">
                                        <input type="text" placeholder="请输入店铺名称" name="name" class="input-sm form-control"> <span class="input-group-btn">
                                            <button type="submit" class="btn btn-sm btn-primary"> 搜索</button> </span>
                                        </div>
                                    </div>
                                </form>
                                    <div class="col-sm-8">
                                        <div class="input-group" >
                                         <!--  <a class="btn btn-sm btn-primary" href="#modal-form_yundan" data-toggle="modal">导出数据</a> -->
                                             <button class="btn btn-sm btn-primary" onclick="export_data()">导出数据</button> 
                                        </div>
                                    </div>
                            </div>
                            <div class="table-responsive">
                                <table class="table table-striped">
                                    <thead>
                                        <tr>
                                            <th></th>
                                            <th>序号</th>
                                            <th>店铺</th>
                                            <th>盘点员</th>
                                            <th>所属月份</th>
                                            <th>盘点时间</th>
                                            <!-- <th>颜色</th>
                                            <th>号型</th>
                                            <th>价格</th>
                                            <th>面料编号</th>
                                            <th>面料属性</th>
                                            <th>所属店铺</th>
                                            <th>库存</th>
                                            <th>入库时间</th> -->
                                            <th>操作</th>

                                        </tr>
                                    </thead>
                                    <tbody>
                                       {volist name="list" id="vo"} 
                                     <tr>
                                        <td>
                                          <input type="checkbox" class="i-checks"  name="input" value="{$vo.id}"> 
                                      </td>
                                      <td>{$vo.id}</td>
                                      <td>{$vo.shop}</td>
                                      <td>{$vo.entry}</td>
                                      <td>{$vo.month||date="Y-m",###}</td>
                                      <td>{$vo.updatetime||date="Y-m-d H:i:s",###}</td>
                                     <td> 
                                        <a data-toggle="modal"  href="{:url('index/shop/showExport',array('shopid'=>$vo['shopid'],'month'=>$vo['month']))}"  title="导出"><i class="iconfont icon-daochu"></i></a>
                                        &emsp;
                                        <a data-toggle="modal"  href="{:url('index/shop/showList',array('shopid'=>$vo['shopid'],'month'=>$vo['month']))}"  title="查看详情"><i class="iconfont icon-chakan"></i></a>
                                        &emsp;
                                        <a href="javascript:;" onclick="delcode({$vo.id})" title="删除"><i class="iconfont icon-shanchu"></i></a></td>
                                    </tr>
                                    {/volist}
                                </tbody>
                            </table>
                            <div style="float: right;line-height: 5.5;">
                             <!--  总库存共<span style="color: red;"></span>件&emsp; -->
                              <div id="pages" style="float: right;margin-left: 50px;"></div>
                           </div>
                       </div>

                   </div>
               </div>
           </div>

       </div>
   </div>

   <div id="modal-form_yundan" class="modal fade" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-body">
                <div class="row">
                    <div class="col-sm-12 b-r">
                        <h3 class="m-t-none m-b">请选择店铺：</h3>
                        <form role="form" action="{:url('index/shop/excel')}" method="post">
                            <div class="form-group">
                                <select name="shopid" id="" class="form-control">
                                  <option value="-1">全部店铺</option>
                                 
                                  <option value=""></option>
                                  
                                </select>
                                
                            </div>
                            <div>
                                <button class="btn btn-sm btn-primary pull-right m-t-n-xs" type="submit"><strong>提交</strong>
                                </button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{/block}
{block name="js"}
<!-- Peity -->
<script src="__INDEX__/js/plugins/peity/jquery.peity.min.js"></script>

<!-- 自定义js -->
<script src="__INDEX__/js/content.js?v=1.0.0"></script>


<!-- iCheck -->
<script src="__INDEX__/js/plugins/iCheck/icheck.min.js"></script>

<script>
    $(document).ready(function () {
        $('.i-checks').iCheck({
            checkboxClass: 'icheckbox_square-green',
            radioClass: 'iradio_square-green',
        });
    });
    function getInfo(id)
    {
        $('#orderid_yun').val(id);
    }
    /*导出excel*/
    function export_data()
    {
       var attr = '';
        $.each($('input:checkbox'),function(){
            if(this.checked){
                attr += $(this).val()+',';
            }
        });
        attr=attr.substring(0,attr.length-1);
        if(attr.length<1)//说明没有选择数据
        {
            swal({   
                title: "没有导出数据",   
                text: "",   
                type: "error",  
            });
        }else{
            alert(attr);
            window.location.href = '/index/shop/listExport/attr/'+attr;
        }
    }
</script>
<script>
        function updateStatus(id)
        {
            swal({   
                title: "确定要修改状态吗?",   
                text: "确认将修改本条数据的状态!",   
                type: "warning",   
                showCancelButton: true,    
                confirmButtonText: "确认", 
                cancelButtonText: '取消',
                closeOnConfirm: false
            },function(){
                $.post('{:url("index/clothes/updateStatus")}', {id: id}, function(data) {
                    if(data == 1){
                     swal({
                        title: "修改成功",
                        text: "",
                        type: "success"
                    });
                     window.location.reload(); 
                 }else{
                   swal({
                    title: "修改失败",
                    text: "",
                    type: "error"
                });
               }
           });
            });
        }
</script>
<script>
        function delcode(id)
        {
          swal({   
            title: "确定要删除数据?",   
            text: "确认将删除该条数据!",   
            type: "warning",   
            showCancelButton: true,    
            confirmButtonText: "确认", 
            cancelButtonText: '取消',
            closeOnConfirm: false
        }, function(){   
          $.post('{:url("index/shop/delPandianList")}', {'id':id}, function(data) {
            if(data.sta == -1 ){
                swal({
                    title: "权限不足",
                    text: "",
                    type: "error"
                });
            }else if(data.sta == 1){
               swal({
                title: "删除成功",
                text: "",
                type: "success"
            });
               window.location.reload();
           }else{
            swal({
                title: "删除失败",
                text: "",
                type: "error"
            });                 
        }
    });
      });
      }
</script>

{/block}